<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const getDaysByMounth = (mounth) => {
            if(mounth < 0 && mounth >= 12) {
                return 0;
            }
            const mounthToDay = new Array(12).fill(30);
            const mounth31 = [0,2,4,6,7,9,11];
            mounthToDay.forEach((item, index) => {
                mounth31.includes(index) && (mounthToDay[index] = 31);
            });
            const isLeap = new Date().getFullYear() % 4 === 0 ? true : false;
            isLeap ? mounthToDay[1] = 29 : mounthToDay[1] = 28;
            console.log(mounthToDay)
            return mounthToDay[mounth];
        }
        console.log(getDaysByMounth(0))
    </script>
</body>
</html>